<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>Date对象 | 个人笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../md/js/布尔值对象.html" />
    
    
    <link rel="prev" href="../../md/js/Array对象.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="3.15"
        data-chapter-title="Date对象"
        data-filepath="md/js/Date对象.md"
        data-basepath="../.."
        data-revision="Mon Sep 03 2018 20:26:06 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html介绍.html">
            
                
                    <a href="../../md/html/html介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        html介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/html常用标签.html">
            
                
                    <a href="../../md/html/html常用标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        html常用标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/html/a标签的使用.html">
            
                
                    <a href="../../md/html/a标签的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        a标签的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/html/表格的介绍.html">
            
                
                    <a href="../../md/html/表格的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        表格的介绍
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/html/列表.html">
            
                
                    <a href="../../md/html/列表.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/html/iframe内嵌框架.html">
            
                
                    <a href="../../md/html/iframe内嵌框架.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        iframe内嵌框架
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="md/html/表单.html">
            
                
                    <a href="../../md/html/表单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="md/html/媒体标签.html">
            
                
                    <a href="../../md/html/媒体标签.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        媒体标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="md/html/下拉框，多行文本域以及对齐方式.html">
            
                
                    <a href="../../md/html/下拉框，多行文本域以及对齐方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        清除样式
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/css/css引入方式.html">
            
                
                    <a href="../../md/css/css引入方式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        css引入方式
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/css/css选择符与选择器.html">
            
                
                    <a href="../../md/css/css选择符与选择器.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        css选择符与选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/css/css字体样式.html">
            
                
                    <a href="../../md/css/css字体样式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        css字体样式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/css/图片的调整.html">
            
                
                    <a href="../../md/css/图片的调整.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        图片的调整
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/css/伪类选择.html">
            
                
                    <a href="../../md/css/伪类选择.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        伪类选择
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="md/css/盒子模型.html">
            
                
                    <a href="../../md/css/盒子模型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        盒子模型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="md/css/浮动.html">
            
                
                    <a href="../../md/css/浮动.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="md/css/定位.html">
            
                
                    <a href="../../md/css/定位.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="md/css/阴影.html">
            
                
                    <a href="../../md/css/阴影.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        阴影
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="md/css/图片溢出处理.html">
            
                
                    <a href="../../md/css/图片溢出处理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        图片溢出处理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="md/css/动画.html">
            
                
                    <a href="../../md/css/动画.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        动画
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="md/css/动画插件.html">
            
                
                    <a href="../../md/css/动画插件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        动画插件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="md/css/旋转菜单.html">
            
                
                    <a href="../../md/css/旋转菜单.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        旋转菜单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.13" data-path="md/css/视口.html">
            
                
                    <a href="../../md/css/视口.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.13.</b>
                        
                        移动端
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.14" data-path="md/css/rem布局.html">
            
                
                    <a href="../../md/css/rem布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.14.</b>
                        
                        rem布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.15" data-path="md/css/权重与雪碧图.html">
            
                
                    <a href="../../md/css/权重与雪碧图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.15.</b>
                        
                        权重问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.16" data-path="md/css/移动底部菜单被系统键盘顶起问题.html">
            
                
                    <a href="../../md/css/移动底部菜单被系统键盘顶起问题.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.16.</b>
                        
                        移动端导航问题
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.17" data-path="md/css/flex布局.html">
            
                
                    <a href="../../md/css/flex布局.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.17.</b>
                        
                        flex布局
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.18" data-path="md/css/fullpage的使用.html">
            
                
                    <a href="../../md/css/fullpage的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.18.</b>
                        
                        fullpage
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.19" data-path="md/css/bootstrap.html">
            
                
                    <a href="../../md/css/bootstrap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.19.</b>
                        
                        bootstrap
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.20" data-path="md/css/媒体查询.html">
            
                
                    <a href="../../md/css/媒体查询.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.20.</b>
                        
                        媒体查询
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/js/js的介绍.html">
            
                
                    <a href="../../md/js/js的介绍.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        JavaScript的介绍
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.1" data-path="md/js/JavaScript数据类型.html">
            
                
                    <a href="../../md/js/JavaScript数据类型.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.1.</b>
                        
                        JavaScript数据类型
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="md/js/数据类型的转换.html">
            
                
                    <a href="../../md/js/数据类型的转换.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.2.</b>
                        
                        数据类型的转换
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="md/js/运算符.html">
            
                
                    <a href="../../md/js/运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.3.</b>
                        
                        运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="md/js/比较运算符.html">
            
                
                    <a href="../../md/js/比较运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.4.</b>
                        
                        比较运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="md/js/赋值运算符.html">
            
                
                    <a href="../../md/js/赋值运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.5.</b>
                        
                        赋值运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="md/js/逻辑操作符.html">
            
                
                    <a href="../../md/js/逻辑操作符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.6.</b>
                        
                        逻辑操作符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="md/js/条件语句.html">
            
                
                    <a href="../../md/js/条件语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.7.</b>
                        
                        条件语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="md/js/条件运算符.html">
            
                
                    <a href="../../md/js/条件运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.8.</b>
                        
                        条件运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="md/js/位运算符.html">
            
                
                    <a href="../../md/js/位运算符.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.9.</b>
                        
                        位运算符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.10" data-path="md/js/循环语句.html">
            
                
                    <a href="../../md/js/循环语句.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.10.</b>
                        
                        循环语句
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="md/js/for循环.html">
            
                
                    <a href="../../md/js/for循环.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.11.</b>
                        
                        for循环
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="md/js/ES6.html">
            
                
                    <a href="../../md/js/ES6.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.12.</b>
                        
                        ES6
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.13" data-path="md/js/内置对象.html">
            
                
                    <a href="../../md/js/内置对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.13.</b>
                        
                        内置对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.14" data-path="md/js/Array对象.html">
            
                
                    <a href="../../md/js/Array对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.14.</b>
                        
                        Array对象
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="3.15" data-path="md/js/Date对象.html">
            
                
                    <a href="../../md/js/Date对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.15.</b>
                        
                        Date对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.16" data-path="md/js/布尔值对象.html">
            
                
                    <a href="../../md/js/布尔值对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.16.</b>
                        
                        布尔值对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.17" data-path="md/js/数学对象.html">
            
                
                    <a href="../../md/js/数学对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.17.</b>
                        
                        数学对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.18" data-path="md/js/对象的创建.html">
            
                
                    <a href="../../md/js/对象的创建.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.18.</b>
                        
                        对象的创建
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.19" data-path="md/js/BOM.html">
            
                
                    <a href="../../md/js/BOM.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.19.</b>
                        
                        BOM
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.20" data-path="md/js/DOM关于元素的获取.html">
            
                
                    <a href="../../md/js/DOM关于元素的获取.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.20.</b>
                        
                        DOM关于元素的获取
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.21" data-path="md/js/DOM元素对象.html">
            
                
                    <a href="../../md/js/DOM元素对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.21.</b>
                        
                        DOM元素对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.22" data-path="md/js/DOM事件练习.html">
            
                
                    <a href="../../md/js/DOM事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.22.</b>
                        
                        DOM事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.23" data-path="md/js/DOM鼠标事件.html">
            
                
                    <a href="../../md/js/DOM鼠标事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.23.</b>
                        
                        DOM鼠标事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.24" data-path="md/js/事件代理.html">
            
                
                    <a href="../../md/js/事件代理.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.24.</b>
                        
                        事件代理
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.25" data-path="md/js/移动端事件.html">
            
                
                    <a href="../../md/js/移动端事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.25.</b>
                        
                        移动端事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.26" data-path="md/js/无缝轮播图.html">
            
                
                    <a href="../../md/js/无缝轮播图.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.26.</b>
                        
                        无缝轮播图
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.27" data-path="md/js/鼠标事件练习.html">
            
                
                    <a href="../../md/js/鼠标事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.27.</b>
                        
                        鼠标事件练习
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.28" data-path="md/js/ajax.html">
            
                
                    <a href="../../md/js/ajax.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.28.</b>
                        
                        ajax
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.29" data-path="md/js/高德地图的使用.html">
            
                
                    <a href="../../md/js/高德地图的使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.29.</b>
                        
                        高德地图的使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="3.30" data-path="md/js/预加载插件使用.html">
            
                
                    <a href="../../md/js/预加载插件使用.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.30.</b>
                        
                        预加载插件使用
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/jQuery/JQ变量的声明.html">
            
                
                    <a href="../../md/jQuery/JQ变量的声明.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        JQ变量的声明
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.1" data-path="md/jQuery/选择器和效果.html">
            
                
                    <a href="../../md/jQuery/选择器和效果.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.1.</b>
                        
                        选择器和效果
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="md/jQuery/属性.html">
            
                
                    <a href="../../md/jQuery/属性.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.2.</b>
                        
                        属性
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="md/jQuery/尺寸.html">
            
                
                    <a href="../../md/jQuery/尺寸.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.3.</b>
                        
                        尺寸
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="md/jQuery/遍历.html">
            
                
                    <a href="../../md/jQuery/遍历.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.4.</b>
                        
                        遍历
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="md/jQuery/正则表达式.html">
            
                
                    <a href="../../md/jQuery/正则表达式.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.5.</b>
                        
                        正则表达式
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="md/jQuery/jQuery事件练习.html">
            
                
                    <a href="../../md/jQuery/jQuery事件练习.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.6.</b>
                        
                        jQuery事件练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5" data-path="gitbook的安装.html">
            
                
                    <a href="../../gitbook的安装.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        gitbook的安装
                    </a>
            
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >个人笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h1 id="&#x5B9A;&#x65F6;&#x5668;">&#x5B9A;&#x65F6;&#x5668;</h1>
<p>setTimeout(callback,time);</p>
<p>callback:&#x56DE;&#x8C03;&#x51FD;&#x6570;&#xFF0C;&#x5B9A;&#x4E49;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x505A;&#x7684;&#x4E8B;&#x60C5;</p>
<p>time&#xFF1A;&#x5B9A;&#x4E49;&#x6BEB;&#x79D2;</p>
<p>setTimeout()&#x5728;time&#x6BEB;&#x79D2;&#x540E;&#x6765;&#x6267;&#x884C;callback&#x8FD9;&#x4E2A;&#x56DE;&#x8C03;&#x51FD;&#x6570;</p>
<p>setInterval(callback,time)</p>
<p>setInterval()&#x65B9;&#x6CD5;&#x8868;&#x793A;&#xFF0C;&#x6BCF;&#x9694;time&#x6BEB;&#x79D2;&#x6267;&#x884C;&#x4E00;&#x6B21;callback&#x51FD;&#x6570;</p>
<p>&#x6E05;&#x9664;&#x5B9A;&#x65F6;&#x5668;&#xFF1A;clearInterval(name);</p>
<p>name&#xFF1A;&#x8BA1;&#x65F6;&#x5668;&#x7684;&#x540D;&#x5B57;</p>
<pre><code>var timeout=setTimeout(function(){
    alert(&quot;&#x606D;&#x559C;&#x4F60;&#xFF0C;&#x4E2D;&#x5956;&#x4E86;&#xFF01;&quot;);
        clearTimeout(timeout);
    },3000);


    var i=0;
    var time= setInterval(function(){
    i++;
    if(i&gt;10){
    clearInterval(time);
    }
    console.log(&quot;&#x606D;&#x559C;&#x4F60;&#xFF0C;&#x4E2D;&#x6BD2;&#x4E86;&#xFF01;&quot;);
    },1000);
</code></pre><h1 id="&#x5012;&#x8BA1;&#x65F6;">&#x5012;&#x8BA1;&#x65F6;</h1>
<pre><code>&lt;h1&gt;&lt;/h1&gt;
var h1=document.querySelector(&quot;h1&quot;);//&#x62FF;&#x5230;h1&#x6807;&#x7B7E;
            var j=5;
            var time=setInterval(function(){
//                document.write(j);
                h1.innerText=j;//&#x5411;h1&#x6807;&#x7B7E;&#x6DFB;&#x52A0;&#x6587;&#x672C;
                j--;
                if(j&lt;0){
                    clearInterval(time);
                }
            },1000);
</code></pre><h1 id="date&#x5BF9;&#x8C61;">Date()&#x5BF9;&#x8C61;</h1>
<p>JavaScript&#x83B7;&#x53D6;&#x5230;&#x7684;&#x65F6;&#x95F4;&#x90FD;&#x662F;&#x4ECE;1970&#x5E74;&#x7684;1&#x6708;1&#x65E5;&#x51CC;&#x6668;00:00&#x5F00;&#x59CB;&#x8BA1;&#x7B97;&#x7684;</p>
<h1 id="&#x7B2C;&#x4E00;&#x79CD;&#x65B9;&#x6CD5;">&#x7B2C;&#x4E00;&#x79CD;&#x65B9;&#x6CD5;</h1>
<p>new Date(); &#x76F4;&#x63A5;&#x83B7;&#x53D6;&#x5230;&#x5F53;&#x524D;&#x65F6;&#x95F4;</p>
<pre><code>var data=new Date();
console.log(data);
</code></pre><h1 id="&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x6CD5;&#xFF0C;&#x4F20;&#x5165;&#x5B57;&#x7B26;&#x4E32;">&#x7B2C;&#x4E8C;&#x79CD;&#x65B9;&#x6CD5;&#xFF0C;&#x4F20;&#x5165;&#x5B57;&#x7B26;&#x4E32;</h1>
<p>&#x83B7;&#x53D6;&#x6307;&#x5B9A;&#x65F6;&#x95F4;&#x7684;&#x65E5;&#x671F;&#xFF0C;&#x5982;&#x679C;&#x4E4B;&#x4F20;&#x5165;&#x5E74;&#x6708;&#x65E5;&#xFF0C;&#x5219;&#x8FD4;&#x56DE;&#x6307;&#x5B9A;&#x65E5;&#x671F;&#x7684;&#x65F6;&#x95F4;&#x7684;&#x65E9;&#x4E0A;8&#x70B9;&#x3002;(&#x4E1C;&#x516B;&#x533A;)</p>
<pre><code>var data1=new Date(&quot;2017-07-31&quot;);
onsole.log(data1);
</code></pre><p>&#x5F53;&#x6211;&#x4EEC;&#x7528;2018-01-21&#x8FD9;&#x79CD;&#x4E2D;&#x5212;&#x7EBF;&#x8FDE;&#x63A5;&#x7684;&#x65E5;&#x671F;&#x683C;&#x5F0F;&#x5E76;&#x5C06;&#x65F6;&#x5206;&#x79D2;&#x4E5F;&#x4F20;&#x5165;date&#x5BF9;&#x8C61;&#x65F6;&#xFF0C;&#x5728;ie&#x6D4F;&#x89C8;&#x5668;&#x4E0A;&#x4E0D;&#x80FD;&#x8BC6;&#x522B;</p>
<p> &#x5728;safari&#x6D4F;&#x89C8;&#x5668;&#x4E5F;&#x662F;&#x4E0D;&#x80FD;&#x8BC6;&#x522B;&#x7684;</p>
<p> &#x7528;2017/07/31&#x8FD9;&#x79CD;&#x683C;&#x5F0F;&#x662F;&#x53EF;&#x4EE5;&#x7684;</p>
<pre><code>var data2=new Date(&quot;2018-01-21 12:12:12&quot;);
//toLocaleString()&#x8F6C;&#x6362;&#x4E3A;&#x672C;&#x5730;&#x7684;&#x65E5;&#x671F;&#x683C;&#x5F0F;
console.log(data2.toLocaleString());
document.write(data2.toLocaleString());
</code></pre><h1 id="&#x7B2C;&#x4E09;&#x79CD;&#x83B7;&#x53D6;&#x65F6;&#x95F4;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x53EF;&#x4EE5;&#x4F20;&#x5165;&#x4E00;&#x4E2A;&#x6BEB;&#x79D2;">&#x7B2C;&#x4E09;&#x79CD;&#x83B7;&#x53D6;&#x65F6;&#x95F4;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;&#x53EF;&#x4EE5;&#x4F20;&#x5165;&#x4E00;&#x4E2A;&#x6BEB;&#x79D2;</h1>
<pre><code>var data3=new Date(1000);
console.log(data3.toLocaleString());//1970/1/1 &#x4E0A;&#x5348;8:00:01
</code></pre><h1 id="&#x7B2C;&#x56DB;&#x79CD;">&#x7B2C;&#x56DB;&#x79CD;</h1>
<pre><code>//JavaScript&#x83B7;&#x53D6;&#x7684;&#x6708;&#x4EFD;&#x662F;&#x4ECE;0&#x5F00;&#x59CB;&#x8BA1;&#x7B97;&#x7684;
var data4=new Date(2014,11,12,23,23,23);
console.log(data4.toLocaleString());
</code></pre><h1 id="&#x65B9;&#x6CD5;&#xFF1A;">&#x65B9;&#x6CD5;&#xFF1A;</h1>
<p>toLocaleString()&#xFF0C;&#x8F6C;&#x6362;&#x4E3A;&#x672C;&#x5730;&#x65E5;&#x671F;&#x683C;&#x5F0F;</p>
<pre><code>var data=new Date();
//&#x83B7;&#x53D6;&#x5E74;&#x4EFD;
var year=data.getFullYear();
console.log(year);//2018&#x5E74;
console.log(data.getMonth());//6&#x6708;(&#x83B7;&#x53D6;&#x5230;&#x7684;&#x6708;&#x4EFD;&#x662F;&#x4ECE;0&#x5F00;&#x59CB;&#x8BA1;&#x7B97;)
console.log(data.getDate());//31--&#x65E5;
console.log(data.getDay());//2--&#x5468;
console.log(data.getHours());//11&#x65F6;
console.log(data.getMinutes());//29--&#x5206;
console.log(data.getSeconds());//46--&#x79D2;
console.log(data.getMilliseconds());//942--&#x6BEB;&#x79D2;
console.log(data.getTime());//1533007852879  &#x83B7;&#x53D6;&#x5230;&#x7684;&#x662F;&#x4ECE;1970&#x5E74;&#x5F00;&#x59CB;&#x5230;&#x5F53;&#x524D;&#x7684;&#x6BEB;&#x79D2;&#x6570;
</code></pre><h1 id="&#x8FD8;&#x5269;7&#x5929;10&#x5C0F;&#x65F6;3&#x5206;">&#x8FD8;&#x5269;7&#x5929;10&#x5C0F;&#x65F6;3&#x5206;</h1>
<pre><code>var strtime=&quot;121767622&quot;;
function settime(strtime){
//&#x5C06;&#x6BEB;&#x79D2;&#x6570;&#x8F6C;&#x6362;&#x4E3A;&#x79D2;
strtime=parseInt(strtime/1000);
console.log(strtime);
var day=parseInt(strtime/(60*60*24));
//&#x5BF9;24&#x6C42;&#x4F59;&#xFF0C;&#x8BA1;&#x7B97;&#x7684;&#x7ED3;&#x679C;&#x5C31;&#x662F;&#x4E0D;&#x8DB3;&#x4E00;&#x5929;&#x7684;&#x5C0F;&#x65F6;&#x6570;
var hour=parseInt(strtime/(60*60)%24);
var minutes=parseInt((strtime/60)%60);
var seconds=parseInt(strtime%60);
return &quot;&#x8FD8;&#x6709;&#x5269;&quot;+day+&quot;&#x5929;&quot;+hour+&quot;&#x5C0F;&#x65F6;&quot;+minutes+&quot;&#x5206;&quot;+seconds+&quot;&#x79D2;&quot;;
}
console.log(settime(strtime));
</code></pre><h1 id="&#x8BA1;&#x7B97;&#x8DDD;&#x79BB;&#x751F;&#x65E5;&#x8FD8;&#x6709;&#x591A;&#x5C11;&#x5929;">&#x8BA1;&#x7B97;&#x8DDD;&#x79BB;&#x751F;&#x65E5;&#x8FD8;&#x6709;&#x591A;&#x5C11;&#x5929;</h1>
<pre><code>&lt;div class=&quot;test&quot;&gt;&lt;/div&gt;
var div=document.querySelector(&quot;.test&quot;);
function paddy(time2){
time2=parseInt(time2/1000);
var day=parseInt(time2/(60*60*24));
var hour=parseInt(time2/(60*60)%24);
var minutes=parseInt(time2/60%60);
var seconds=parseInt(time2%60);
return &quot;&#x8DDD;&#x79BB;&#x751F;&#x65E5;&#x8FD8;&#x6709;&#x5269;&quot;+day+&quot;&#x5929;&quot;+hour+&quot;&#x5C0F;&#x65F6;&quot;+minutes+&quot;&#x5206;&quot;+seconds+&quot;&#x79D2;&quot;;
}
setInterval(function(){
var data=new Date();
var data1=new Date(2019,4,18);
var time=data.getTime();
var time1=data1.getTime();
var time2=time1-time;
//&#x8C03;&#x7528;&#x51FD;&#x6570;&#x5E76;&#x628A;&#x7ED3;&#x679C;&#x8D4B;&#x503C;&#x7ED9;totaltime
var totaltime=paddy(time2);
//&#x628A;totaltime&#x503C;&#x8D4B;&#x503C;&#x7ED9;div
div.innerText=totaltime;
},1000)
</code></pre><h1 id="parse&#x83B7;&#x53D6;1970&#x5E74;1&#x6708;1&#x65E5;&#x6307;&#x5B9A;&#x65E5;&#x671F;&#x5230;&#x7684;&#x6BEB;&#x79D2;&#x6570;">parse(),&#x83B7;&#x53D6;1970&#x5E74;1&#x6708;1&#x65E5;&#x6307;&#x5B9A;&#x65E5;&#x671F;&#x5230;&#x7684;&#x6BEB;&#x79D2;&#x6570;</h1>
<pre><code>var data = Date.parse(&quot;2012/3/9&quot;);
console.log(data);
</code></pre><p> setMonth(month&#xFF0C;day)&#xFF1B;</p>
<p> month:&#x4EE3;&#x8868;&#x6708;&#x4EFD;&#x503C;(0-11)</p>
<p>day&#xFF1A;&#x4EE3;&#x8868;&#x4E00;&#x4E2A;&#x6708;&#x4E2D;&#x7684;&#x7B2C;&#x51E0;&#x5929;</p>
<p> &#x6CE8;&#x610F;&#xFF1A;&#x4E24;&#x4E2A;&#x53C2;&#x6570;&#x5FC5;&#x987B;&#x586B;&#x5199;&#x3002;</p>
<pre><code>var data1=new Date();
console.log(data1.getFullYear());//2018&#x5E74;
data1.setFullYear(&quot;2016&quot;);//&#x8BBE;&#x7F6E;&#x5E74;&#x4EFD;
console.log(data1.getFullYear());//2016&#x5E74;
console.log(data1.setMonth(1,20));//&#x8BBE;&#x7F6E;&#x6708;&#x4EFD;&#x548C;&#x65E5;&#x671F;
//data1.setDate(23);//&#x8BBE;&#x7F6E;&#x51E0;&#x53F7;
data1.setHours(12);//&#x8BBE;&#x7F6E;&#x5C0F;&#x65F6;
data1.setMinutes(20);//&#x8BBE;&#x7F6E;&#x5206;&#x949F;
data1.setSeconds(46);//&#x8BBE;&#x7F6E;&#x79D2;
data1.setMilliseconds(12);//&#x8BBE;&#x7F6E;&#x6BEB;&#x79D2;
console.log(data1.toLocaleString());
</code></pre><pre><code>Date.prototype.toLocaleString=function(){
return this.getFullYear()+&quot;-&quot;+(this.getMonth()+1)+&quot;-&quot;+this.getDate();
}
var data3=new Date();
console.log(data3);
console.log(data3.toLocaleString());
console.log(data3.toLocaleDateString());//2018/7/31
console.log(data3.toDateString());//Tue Jul 31 2018
console.log(data3.toLocaleTimeString());//&#x4E0B;&#x5348;3:46:03
</code></pre>
                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/js/Array对象.html" class="navigation navigation-prev " aria-label="Previous page: Array对象"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../md/js/布尔值对象.html" class="navigation navigation-next " aria-label="Next page: 布尔值对象"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
